In general, an IC card utilized as a portable electronic apparatus includes an card-like main body formed of, e.g., plastic and an IC module embedded in the main body. The IC module has an IC chip. The IC chip has a nonvolatile memory such as an EEPROM (Electrically Erasable Programmable Read-Only Memory) or a flash ROM that can hold data even though a power supply is not provided and a CPU that executes various kinds or arithmetic operations.
The IC card is superior in portability and can perform communication with external devices and complicated arithmetic operations. Further, since counterfeiting is difficult, using the IC card in a security system, electronic commerce and others to store highly-confidential information is assumed.
Furthermore, in recent years, an IC card that can transmit and receive data through contactless communication has generally spread. Such a contactless IC card includes an IC chip and an antenna. This contactless IC card operates by energizing the antenna in the card based on electromagnetic induction upon receiving a magnetic field generated from a reader/writer in an IC card processor which processes IC cards.
Meanwhile, when a plurality of IC cards are present in a communication enabled range, a situation where a terminal device cannot correctly recognize the plurality of IC cards in an initial response may possibly occur. To avoid this collision and correctly recognize the plurality of IC cards, the terminal device can execute anti-collision processing in, e.g., a time slot system, a slot marker system or any other system.
When executing the anti-collision processing based on the time slot system, the IC card processor sets a plurality of time frames and transmits an initial response request to an IC card. The IC card generates a random number, selects a time frame in accordance with the random number, and transmits a card ID stored in itself as a response to the IC card processor in the selected time frame. The IC card processor selects the IC card which executes processing based on the received card ID.
However, for example, if the plurality of IC cards select the same time frame, the IC card processor cannot normally receive card IDs.
Further, when executing the anti-collision processing based on the slot marker system, the IC card processor transmits an initial response request including a total number N of slots (time frames) to a plurality of IC cards. Each IC card uses a logic circuit to generate n (an integer) in N integers from 0 to (N−1), for example. When the generated n is 0, the IC card immediately sends an initial response. When the generated n is not 0, the IC card does not immediately send an initial response but sends the initial response at the time that it thereafter receives a slot marker command specifying the same slot as n generated by the contactless IC card is received from the terminal device.
When executing processing based on the time slot system, a time of a time frame set by the IC card processor is fixed. Therefore, for example, when a time frame that is not selected by the IC card is present before a time frame selected by the IC card, there is a problem that a communication time incurs waste.
Moreover, a portable electronic apparatus disclosed in the above-described patent document selects a time frame following a selected time frame when there is a response from another IC card in the selected time frame.
Additionally, as described above, in the slot marker system in the conventional anti-collision processing, the IC card sends an initial response when it receives a command from an external terminal that has specified the same slot as a selected value. Therefore, even in case of a slot in which no response is supplied from another contactless card, the contactless IC card must wait by without making a response, and there is a problem that an entire processing time becomes long.